import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


//Servlet中的注解，功能是把类和HTTP的特定请求关联起来，根据HTTP提供的URL的路径进行关联
@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
    //根据请求生成响应
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //把调用父类的代码删除掉,父类代码返回了一个错误的响应405

        //向HTTP响应中写入了一个body
        resp.getWriter().write("hello World");
    }
}
